[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This is the manual for the vbcc compiler system.

Copyright 1995-2001 Volker Barthelmann

1. General


1.1 Introduction

vbcc is a highly optimizing portable and retargetable ISO C compiler. It supports ISO C according to ISO/IEC 9899:1989 and a subset of the new standard ISO/IEC 9899:1999 (C99).

It is split into a target-independent and a target-dependent part, and provides complete abstraction of host- and target-arithmetic. Therefore, it fully supports cross-compiling for 8, 16, 32 and 64bit architectures.

Embedded systems are supported by features like different pointer-sizes (e.g. differently sized function- and object-pointers or near- and far-pointers), ROM-able code, inline-assembly, bit-types, interrupt-handlers, section-attributes, stack-calculation and many others (depending on the backend).

vbcc provides a large set of aggressive high-level optimizations (see section 3.4 Optimizations) as well as target-specific optimizations to produce faster or smaller code. Rather than restricting analysis and optimization to single functions or files, vbcc is able to optimize across functions and even modules. Target-independent optimizations include:


1.2 Legal

vbcc is copyright in 1995-2001 by Volker Barthelmann.

This archive may be redistributed without modifications and used for non-commercial purposes.

Distributing modified versions and commercial usage needs my written consent.

This copyright applies to vc, vbcc and vsc.

This archive may contain other tools (e.g. assemblers or linkers) which do not fall under this license. Please consult the corresponding documentation of these tools.

vbcc contains the preprocessor ucpp by Thomas Pornin. Included is the copyright notice of ucpp (note that this license does not apply to vbcc or any other part of this distribution):

 
/*
 * (c) Thomas Pornin 1999, 2000
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 4. The name of the authors may not be used to endorse or promote
 *    products derived from this software without specific prior written
 *    permission.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */


1.3 Installation

The vbcc directory tree looks as follows:

`vbcc/bin'
The executables.

`vbcc/config'
Config files for the frontend.

`vbcc/targets/<target>'
Subdirectory containing all files specific to a certain target (e.g. m68k-amigaos or ppc-eabi).


1.3.1 Installing for Unix

  1. Extract the archive.

  2. Set the environment variable VBCC to the vbcc directory. Depending on your shell this might be done e.g. by

     
            VBCC=<prefix>/vbcc
    

    or

     
            setenv VBCC <prefix>/vbcc
    

  3. Include <prefix>/vbcc/bin to your search-path. Depending on your shell this might be done e.g. by

     
            PATH=<prefix>/vbcc/bin:"$PATH"
    

    or

     
            setenv PATH <prefix>/vbcc/bin:"$PATH"
    


1.3.2 Installing for DOS/Windows

  1. Extract the archive.

  2. Set the environment variable VBCC to the vbcc directory.

     
            set VBCC=<prefix>\vbcc
    

  3. Include <prefix>/vbcc/bin to your search-path.

     
            set PATH=<prefix>\vbcc\bin;%PATH%
    


1.3.3 Installing for AmigaOS

To use vbcc on AmigaOS, several assigns have to be set (e.g. in `s:user-startup'):

 
assign >NIL: vbcc: <path to vbcc directory>
assign >NIL: C: vbcc:bin add
 
assign >NIL: vbccm68k: vbcc:targets/m68k-amigaos
assign >NIL: vincludem68k: vbccm68k:include
assign >NIL: vincludem68k: <path to your AmigaOS header files> ADD
;assign >NIL: ixinclude: <path to ixemul header files, if needed>
assign >NIL: vlibm68k: vbccm68k:lib

assign >NIL: vbccppc: vbcc:targets/ppc-powerup
assign >NIL: vincludeppc: vbccppc:include
assign >NIL: vlibppc: vbccppc:lib
assign >NIL: vincludeppc: <path to your AmigaOS header files> ADD

assign >NIL: vbccwos: vbcc:targets/ppc-warpos
assign >NIL: vincludewos: vbccwos:include
assign >NIL: vlibwos: vbccwos:lib
assign >NIL: vincludewos: <path to your AmigaOS header files> ADD

assign >NIL: vbccmos: vbcc:targets/ppc-morphos
assign >NIL: vincludemos: vbccmos:include
assign >NIL: vlibmos: vbccmos:lib
assign >NIL: vincludemos: <path to your MorphOS header files> ADD

Also, the stack-size has to be increased from the default. 40KB is a sensible value, for very large projects higher values might be necessary.

There is a sample script file `init_vbcc'. Changing to the vbcc-directory and executing this script will set up a basic vbcc system. However, it is recommended to adapt the script and put it into your `s:user-startup'.

There are different configuration files provided in the `config'-subdirectory to choose different targets (i.e. the system you want to generate programs for) and hosts (i.e. the system you want the compiler an tools to run on). The general naming-scheme for these files ist <target>_<host>.

The systems available as targets are `m68k' (AmigaOS on 68k with standard libraries), `ixemul' (AmigaOS on 68k using ixemul library), `ppc' (PPC boards using the PowerUp system), `warpos' (PPC boards using the WarpOS system) and `morphos' (PPC systems running MorphOS).

`m68k', `ppc' and `warpos' are available as host specifiers on AmigaOS.

You can choose one of these systems using the `+'-option of vc, e.g.

 
    vc +m68k_ppc ...

will compile for AmigaOS/68k using the compiler running on PowerUp.

You may choose to create copies of some of these configuration files with simpler names. E.g. if you usually want the compiler to run on WarpOS you could copy `m68k_warpos' to `m68k', `warpos_warpos' to `warpos' and so on. Then you can just specify the target and your preferred host system will be chosen automatically.

Additionally, you may copy the configuration file for your preferred host/target-combination to `vc.config'. This configuration will be chosen by default if you do not specify anything.

By default, the target-only-specifications use 68k-native tools, e.g. `+warpos' will create code for WarpOS, but the compiler and tools will run on the 68k. The default `vc.config' will create code for 68k using tools running on 68k.


1.4 Tutorial

Now you should be able to use vbcc. To compile and link the program `hello.c', type
 
        vc hello.c
The file `hello.c' will be compiled and linked to create the executable a.out in the current directory.
 
        vc hello.c -o hello
will do the same, but the created executable will be called `hello'.
 
        vc -c t1.c t2.c
will compile `t1.c' and `t2.c' without linking, creating the object files `t1.o' and `t2.o'.
 
        vc t1.o t2.o -o tt
will link them together and create the executable `tt'. If your program uses floating point, you may have to link with a math-library. The details are dependent on the target, but usually `-lm' will be suitable (for AmigaOS on m68k choose one of `-lmieee', `-lm881' or `-lm040').

 
        vc calc.c -o calc -lmieee
There may also be an extra.lib which includes a few functions that are no standard C functions but some people seem to regard them as standard functions. If you use one of these add `-lextra' to the commandline.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Volker Barthelmann on June, 26 2001 using texi2html